﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class AdminBLL
    {

        #region 增删改查
        /// <summary>
        /// 添加角色信息
        /// </summary>
        /// <returns></returns>
        public int Add<T>(T t)
        {
            return Factory.CreateAdminDAL().Add<T>(t);
        }
        /// <summary>
        /// 获取角色信息表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public List<T> GetList<T>()
        {
            return Factory.CreateAdminDAL().GetList<T>();
        }
        /// <summary>
        /// 根据角色编号删除角色信息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteById<T>(int id)
        {
            return Factory.CreateAdminDAL().DeleteById<T>(id);
        }
        /// <summary>
        /// 修改角色信息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool Update<T>(T t)
        {
            return Factory.CreateAdminDAL().Update<T>(t);
        }


        /// <summary>
        /// 根据编号修改部门的状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int UpdateState(int id, int state)
        {
            return Factory.CreateAdminDAL().UpdateState(id, state);
        }


        /// <summary>
        /// 根据编号角色的状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int UpdateRoleState(int id, int state)
        {
            return Factory.CreateAdminDAL().UpdateRoleState(id, state);
        }

        /// <summary>
        /// 根据编号用户的状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public int UpdateUsersState(int id, int state)
        {
            return Factory.CreateAdminDAL().UpdateUsersState(id, state);
        }

        #endregion

        #region 根据角色编号获取对应的权限
        /// <summary>
        /// 根据角色编号获取对应的权限
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<SysAuthorityAndRoles> GetListByRoleId(int id)
        {
            return Factory.CreateAdminDAL().GetListByRoleId(id);
        }
        #endregion

        #region 显示登记表
        /// <summary>
        /// 显示登记表
        /// </summary>
        /// <returns></returns>
        public List<_Register> RegisterList()
        {
            return Factory.CreateAdminDAL().RegisterList();
        }
        #endregion

        #region 根据部门编号获取勘查员信息
        public List<SysUser> GetListByDeptId_3(int id)
        {
            return Factory.CreateAdminDAL().GetListByDeptId_3(id);
        }
        #endregion

        #region 根据部门编号获取估价员员信息
        public List<SysUser> GetListByDeptId_4(int id)
        {
            return Factory.CreateAdminDAL().GetListByDeptId_4(id);
        }
        #endregion

        #region 获取数据库中的最后一个项目号
        /// <summary>
        /// 获取数据库中的最后一个项目号
        /// </summary>
        /// <returns></returns>
        public string SelectProjectNumber()
        {
            return Factory.CreateAdminDAL().SelectProjectNumber();
        }
        #endregion

        #region 修改项目状态为已勘察
        /// <summary>
        /// 修改项目状态为已勘察
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public int UpdateState(string number)
        {
            return Factory.CreateAdminDAL().UpdateState(number);
        }
        #endregion

        #region 根据ProjectNumber 进行查询
        /// <summary>
        /// 根据ProjectNumber 进行查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ProjectNumber"></param>
        /// <returns></returns>
        public T GetAssessmentProjectNumber<T>(string ProjectNumber)
        {
            return Factory.CreateAdminDAL().GetAssessmentProjectNumber<T>(ProjectNumber);
        }
        #endregion

        #region 根据项目编号 修改为已评估状态
        /// <summary>
        /// 修改为已评估状态
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public int UpdateState(EABasic_Info eabasic)
        {
            return Factory.CreateAdminDAL().UpdateState(eabasic);
        }
        #endregion

        #region 根据项目编号查询审核详情
        /// <summary>
        /// 根据项目编号查询审核详情
        /// </summary>
        /// <param name="ProjectNumber"></param>
        /// <returns></returns>
        public List<EAAuditing> GetAuditDetails(string ProjectNumber)
        {
            return Factory.CreateAdminDAL().GetAuditDetails(ProjectNumber);
        }
        #endregion

    }
}
